﻿using Microsoft.WowAddonStudio.FrameXml.Serialization.LayoutFrames;
using NUnit.Framework;

namespace Microsoft.WowAddonStudio.FrameXml.Serialization.Tests
{
	[TestFixture]
	public class TextureTest : SerializationTestBase<Texture>
	{
		[Test]
		public void BasicTest()
		{
			InitializeTestEntity("Simple/Texture.xml");

			Assert.AreEqual("TestTexture", TestEntity.Name);
			Assert.IsNotNull(TestEntity.File);
            Assert.IsNotNull(TestEntity.SizeDimension);
			Assert.IsNotNull(TestEntity.Anchors);
			Assert.IsNotNull(TestEntity.Color);
			Assert.IsNotNull(TestEntity.TexCoords);
		}

		/// <summary>
		/// Gets the entity to be tested from a <see cref="Ui"/> instance.
		/// </summary>
		/// <param name="ui">The ui instance.</param>
		/// <returns>
		/// An instance of the <typeparamref name="TSerializationObject"/> class.
		/// </returns>
		protected override Texture GetTestEntity(Ui ui)
		{
			Assert.IsNotNull(ui.LayoutFrames);
			Assert.AreEqual(1, ui.LayoutFrames.Count);

			// Ui/Texture[0]
			Assert.IsTrue(ui.LayoutFrames[0] is Texture);
			return (Texture) ui.LayoutFrames[0];
		}
	}
}